package cn.iocoder.yudao.module.project.dal.mysql.deliveryreceipt;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.deliveryreceipt.DeliveryReceiptDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.deliveryreceipt.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 产品拨交单 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DeliveryReceiptMapper extends BaseMapperX<DeliveryReceiptDO> {

    default PageResult<DeliveryReceiptDO> selectPage(DeliveryReceiptPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeliveryReceiptDO>()
                .eqIfPresent(DeliveryReceiptDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(DeliveryReceiptDO::getOrderTotal, reqVO.getOrderTotal())
                .eqIfPresent(DeliveryReceiptDO::getDeliveryCount, reqVO.getDeliveryCount())
                .eqIfPresent(DeliveryReceiptDO::getOutDeptId, reqVO.getOutDeptId())
                .likeIfPresent(DeliveryReceiptDO::getOutDeptName, reqVO.getOutDeptName())
                .eqIfPresent(DeliveryReceiptDO::getRecvDeptId, reqVO.getRecvDeptId())
                .likeIfPresent(DeliveryReceiptDO::getRecvDeptName, reqVO.getRecvDeptName())
                .betweenIfPresent(DeliveryReceiptDO::getSubmitTime, reqVO.getSubmitTime())
                .eqIfPresent(DeliveryReceiptDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeliveryReceiptDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeliveryReceiptDO::getId));
    }

    List<DeliveryReceiptDO> getDeliveryReceiptReport(Page<DeliveryReceiptPageReqVO> pageParam, @Param("reqVO") DeliveryReceiptPageReqVO pageReqVO);
}